/*
 * Main.fx
 *
 * Created on 02-ene-2011, 13:41:39
 */
package dydapp;

import java.util.Calendar;
import origendatos.dyd.model.HabilidadesJpaController;
import origendatos.dyd.model.Habilidades;
import java.util.List;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.image.ImageView;
import java.lang.Thread;

/**
 * @author erodrig
 */
public class Main {

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:main
    public-read def listView: javafx.scene.control.ListView = javafx.scene.control.ListView {
        visible: false
        layoutX: 57.0
        layoutY: 60.0
        items: [ "Item 1", "Item 2", "Item 3", ]
    }
    
    public-read def instance: javafx.scene.control.Button = javafx.scene.control.Button {
        layoutX: 219.0
        layoutY: 261.0
        text: "Ejemplo_Habilidades"
        action: buttonAction
    }
    
    public-read def image: javafx.scene.image.Image = javafx.scene.image.Image {
        url: "http://t3.gstatic.com/images?q=tbn:ANd9GcTjVGTr3R1AM1WSxbP3HgnzuxicDXXhZyxV1_r8YEI-GQY8ooZTgg&t=1"
        backgroundLoading: false
        smooth: true
        width: 300.0
        height: 300.0
        placeholder: null
        preserveRatio: true
    }
    
    public-read def imageView: javafx.scene.image.ImageView = javafx.scene.image.ImageView {
        layoutX: 81.0
        layoutY: 92.0
        image: image
    }
    
    public-read def scene0: javafx.scene.Scene = javafx.scene.Scene {
        width: 800.0
        height: 600.0
        content: getDesignRootNodes ()
    }
    
    public-read def currentState: org.netbeans.javafx.design.DesignState = org.netbeans.javafx.design.DesignState {
    }
    
    public function getDesignRootNodes (): javafx.scene.Node[] {
        [ imageView, listView, instance, ]
    }
    
    public function getDesignScene (): javafx.scene.Scene {
        scene0
    }
    // </editor-fold>//GEN-END:main

    function buttonAction(): Void {
            
         var listView :javafx.scene.control.ListView = getDesignRootNodes()[1] as javafx.scene.control.ListView;

         if (listView.visible==true){listView.visible=false;
         }
         else listView.visible=true;


         }

}

function run (): Void {
    var design = Main {};




    javafx.stage.Stage {
        title: "D&D"
        scene:  design.getDesignScene();
        

    }
    var i =0;
    var habilidadesController: HabilidadesJpaController= new HabilidadesJpaController;
    var listaHabilidades : List =habilidadesController.findHabilidadesEntities();
var arreglo :Object[];


    for(habi in listaHabilidades){
arreglo[i]= (habi as Habilidades).getNombre();
i++;
        }
design.listView.items=arreglo;
}
